package com.ry.demo.register.client.dto;


/**
 * @Description: 负责发送http请求组件
 */
public class HttpSender {

    /**
     * 发送注册请求
     * @param request
     */
    public RegisterResponse register(RegisterRequest request){

        // 基于开源的http请求组件
        // 构造一个请求，请求中包含服务名称，服务实例id，ip地址，ip端口

        System.out.println("服务实例【" + request + "】，发送请求进行注册......");

        RegisterResponse registerResponse = new RegisterResponse();
        registerResponse.setStatus(RegisterResponse.SUCCESS);

        return registerResponse;
    }

    /**
     * 发送心跳请求
     * @param request
     */
    public HeartbeatResponse heartbeat(HeartbeatRequest request){
        System.out.println("服务实例【" + request + "】，发送请求进行心跳......");

        HeartbeatResponse heartbeatResponse = new HeartbeatResponse();
        heartbeatResponse.setStatus(HeartbeatResponse.SUCCESS);

        return heartbeatResponse;

    }


}
